window.onload = function () {
  let obj = document.getElementById("body");
  body.addEventListener("click", function (event) {
    let target = event.target;
    console.log(target);
    console.log(target.classList);
    if (target.classList.contains("github")) {
      alert("不好意思, Github八百年没用过了, 想看代码的请查看我的gitee吧")
    }
    if (target.classList.contains("weixin")) {
      alert("我的微信号是wyblovecoding!");
    }
    if (target.classList.contains("mpweixin")) {
      alert("我的微信公众号是爱玩车的程序员!");
    }
    if (target.classList.contains("douyin")) {
      alert("我的抖音号是wyblovecoding!");
    }

    if (target.classList.contains("icon-menu")) {
      toggleClass(target, "hidden");
      toggleClass(document.getElementById("click-icon-close"), "hidden");
      toggleClass(document.getElementById("nav-action-menu-list"), "hidden");
      toggleClass(document.getElementById("body"), "nav-open-noscroll");
    }

    if (target.classList.contains("icon-close")) {
      toggleClass(target, "hidden");
      toggleClass(document.getElementById("click-icon-menu"), "hidden");
      toggleClass(document.getElementById("nav-action-menu-list"), "hidden");
      toggleClass(document.getElementById("body"), "nav-open-noscroll");
    }
  });
};

function toggleClass(target, className) {
  if(target.classList.contains(className)){
    target.classList.remove(className)
  }else{
    target.classList.add(className);
  }
}
